<ui:composition
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
	xmlns:f="http://xmlns.jcp.org/jsf/core"
	xmlns:h="http://xmlns.jcp.org/jsf/html"
	xmlns:p="http://primefaces.org/ui"
	xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
	template="/WEB-INF/templates/default.xhtml"
	xmlns:pe="http://primefaces.org/ui"
>

	<f:metadata>
		<f:viewParam
			name="bulletinId"
			value="#{bulletinHome3.id}"
		></f:viewParam>
		<f:event
			listener="#{bulletinHome3.initConversation()}"
			type="preRenderView"
		></f:event>
	   	<f:viewParam name="moduleName" value="公告重新选取"></f:viewParam>
	</f:metadata>
	<ui:define name="head">
		<style type="text/css">
			.removeButton {
				float: right;
				margin-right: 20px;
			}
			
			.limitUnit {
				margin-top: 5px;
			}
			h2{
   				text-align:center
   			}
   			.rowStyle{
	   			text-align: center;
	   			font-size:16px
   			}
		</style>
	</ui:define>
	<ui:define name="content">

		<h:form id="editForm">
			<p:panel
				id="panel"
				header="公告基本信息"
				style="margin-bottom:10px;"
			>
				<p:messages id="messages" closable="true">
		       		<p:autoUpdate />
		       	</p:messages>
				<ui:include src="../template/include/bulletinInfo.xhtml" />
			</p:panel>
			
			<ui:include src="../template/include/bulletinReqInfo.xhtml" />
			<p:panel
				id="photos"
				header="交易申请表"
				style="margin-bottom:10px;"
						>
					<div id="imgsPreview" >
						<p:repeat
							var="_photo"
							value="#{bulletinHome3.instance.photos}"
						>
							<img  data-original="#{attachmentUtils.getFullPath(_photo)}" src="#{attachmentUtils.getFullPath(_photo)}"  width="240"/>
						</p:repeat>
					</div>	
				</p:panel>
			<p:panel header="相关附件">	
				 	<ui:include src="/WEB-INF/templates/include/bulletinAttachments.xhtml" />
			</p:panel>
			
			<p:panel
				id="selecteSupplier"
				header="中选中介"
				rendered="#{not empty bulletinHome3.instance.successTrade}"
				style="margin-bottom:10px;"
			>
				<p:outputLabel
					for="supplier"
					value="中介名称："
					style="margin:5px 10px"
				></p:outputLabel>
				<h:outputText
					id="supplier"
					value="#{bulletinHome3.instance.successTrade.supplier.cnname}"
				/>
			</p:panel>
			<p:commandButton
				oncomplete="PF('rechooseDialog').show();"
				value="重新选取"
				immediate="true"
				rendered="#{bulletinHome3.instance.tradeStatus eq 'Agreed'}"
			/>	
			<ui:remove>
				 
			</ui:remove>
			
				<p:confirmDialog global="true" showEffect="fade" hideEffect="fade">
			        <p:commandButton value="确认" type="button" styleClass="ui-confirmdialog-yes" icon="pi pi-check" />
			        <p:commandButton value="取消" type="button" styleClass="ui-confirmdialog-no" icon="pi pi-times" />
			    </p:confirmDialog>   
			<p:button
				outcome="BulletinList.xhtml"
				value="取消"
				immediate="true"
			></p:button>
		</h:form>
		
		<p:dialog
			id="rechooseDialog"
			widgetVar="rechooseDialog"
			width="500px"
			height="300px"
		>
			<f:facet name="header">
				设置重新选取时间
			</f:facet>
			<h:form>
				<h:panelGrid columns="2">
					<p:outputLabel
						for="reChooseReason"
						value="重新选取原因"
					></p:outputLabel>
					<p:inputTextarea id="reChooseReason" value="#{bulletinHome3.instance.reChooseReason}" 
						required="true" 
						maxlength="50"
						>
					</p:inputTextarea>
					<p:outputLabel
						for="chooseTime"
						value="重新选取时间"
					></p:outputLabel>
					<p:calendar id="chooseTime" value="#{bulletinHome3.instance.chooseTime}" 
						required="true" 
						pattern="yyyy-MM-dd HH:mm"
						navigator="true">
					</p:calendar>
				</h:panelGrid>
				<br/>
				<p:commandButton
					action="#{bulletinHome3.rechoose()}"
					value="重新选取"
					ajax="false"
				>
					
				</p:commandButton>
				<p:commandButton
					oncomplete="PF('rechooseDialog').hide();"
					value="取消"
					immediate="true"
				></p:commandButton>
			</h:form>
		</p:dialog>
		
	</ui:define>
</ui:composition>
